package koction.model.seller;

import java.util.List;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import koction.model.product.ProductVO;
@Repository
public class SellerDaoImpl implements SellerDao {
	@Resource(name="sqlSessionTemplate")
	private SqlSessionTemplate sqlSessionTemplate;
	/* (non-Javadoc)
	 * @see koction.model.seller.SellerDao#getProductList(koction.model.seller.SellerVO)
	 */
	@Override
	public List<ProductVO> getProductList(SellerVO sellerVO){
		return this.sqlSessionTemplate.selectList("seller.getProductList",sellerVO);
	}
	@Override
	public ProductVO updateProductView(int productId) {
		return this.sqlSessionTemplate.selectOne("seller.updateProductView",productId);
	}
	@Override
	public List<String> registerProductView() {
		return this.sqlSessionTemplate.selectList("seller.registerProductView");
	}
	@Override
	public void updateProduct(ProductVO pvo) {
		this.sqlSessionTemplate.update("seller.updateProduct",pvo);
	}
	@Override
	public void delelteProduct(String productId) {
		this.sqlSessionTemplate.update("seller.delelteProduct",productId);
	}
	@Override
	public List<ProductVO> getProductListOrderByPrice(SellerVO sellerVO) {
		return this.sqlSessionTemplate.selectList("seller.getProductListOrderByPrice",sellerVO);
	}
	@Override
	public List<ProductVO> getProductListOrderByDate(SellerVO sellerVO) {
		return this.sqlSessionTemplate.selectList("seller.getProductListOrderByDate",sellerVO);
	}
	@Override
	public List<ProductVO> getProductListOrderBySalesVolume(SellerVO sellerVO) {
		return this.sqlSessionTemplate.selectList("seller.getProductListOrderBySalesVolume",sellerVO);
	}
	
	@Override
	public void registerProduct(ProductVO pvo) throws Exception {
		sqlSessionTemplate.insert("seller.registerProduct",pvo);
	
	}
	@Override
	public List<String> getCategoryView() throws Exception {
		return sqlSessionTemplate.selectList("seller.registerProductView");
	}
	@Override
	public SellerVO updateSellerView(String sellerId) throws Exception {
		return sqlSessionTemplate.selectOne("seller.updateSellerView", sellerId);
	}
	@Override
	public void updateSeller(SellerVO svo) throws Exception {
		sqlSessionTemplate.update("seller.updateSeller",svo);
		
	}
}
